import request from "@/utils/request";

// 获取所有的角色
export function role() {
  return request({
    url: "/roles",
    method: "get",
  });
}

// 新增角色
export function addRole(data) {
  return request({
    url: "/roles",
    method: "post",
    data
  });
}


// 编辑角色
export function editRole(data) {
  return request({
    url: "/roles",
    method: "put",
    data
  });
}

// 删除角色
export function delRole(id) {
  return request({
    url: `/roles/${id}`,
    method: "delete",
  });
}

// 删除角色下的权限
export function delMenu(rid, mid) {
  return request({
    url: `/role/del_menu/${rid}/${mid}`,
    method: "post",
  });
}

// 设置角色下的权限
export function setRoleMenu(data) {
  return request({
    url: `/roles/set_per`,
    method: "post",
    data,
  });
}
